:root {
  /* 浅色主题 */
  --primary-color: #2196F3;
  --secondary-color: #1976D2;
  --background-color: #f0f2f5;
  --result-bg-color: #ffffff;
  --group-bg-color: #f8f9fa;
  --card-bg-color: #ffffff;
  --text-color: #2c3e50;
  --text-secondary: #666666;
  --border-color: rgba(33, 150, 243, 0.2);
  --border-radius: 8px;
  --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --group-border: 1px solid var(--border-color);
}

:root[data-theme="dark"] {
  /* 深色主题 */
  --primary-color: #64B5F6;
  --secondary-color: #42A5F5;
  --background-color: #1a1a1a;
  --result-bg-color: #2d2d2d;
  --group-bg-color: #333333;
  --card-bg-color: #2d2d2d;
  --text-color: #e0e0e0;
  --text-secondary: #a0a0a0;
  --border-color: rgba(100, 181, 246, 0.2);
  --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  --clear-btn-color: #FF8A80;
  --clear-btn-hover: rgba(255, 138, 128, 0.1);
}

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  min-width: 320px;
  padding: 20px;
  background: var(--background-color);
  color: var(--text-color);
  margin: 0;
  transition: background-color 0.3s ease;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

#title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
  position: relative;
}

#title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.theme-switch {
  position: relative;
  width: 40px;
  height: 20px;
  cursor: pointer;
  margin-left: 8px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--group-bg-color);
  border-radius: 20px;
  transition: .4s;
  border: 1px solid var(--border-color);
}

.theme-switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 1px;
  background-color: var(--primary-color);
  border-radius: 50%;
  transition: .4s;
}

input:checked + .theme-switch-slider {
  background-color: var(--group-bg-color);
}

input:checked + .theme-switch-slider:before {
  transform: translateX(20px);
}

.theme-icon-group {
  position: relative;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-icon {
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
  margin: 0;
}

.theme-icon img {
  width: 100%;
  height: 100%;
  transition: all 0.3s ease;
}

.theme-icon:hover img {
  filter: brightness(1.2);
}

.theme-icon.light {
  opacity: 1;
}

.theme-icon.dark {
  opacity: 0;
}

:root[data-theme="dark"] .theme-icon.light {
  opacity: 0;
}

:root[data-theme="dark"] .theme-icon.dark {
  opacity: 1;
}

select {
  width: auto;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--card-bg-color);
  font-size: 13px;
  color: var(--text-color);
  transition: all 0.3s ease;
  cursor: pointer;
  margin-left: 8px;
  min-width: 120px;
}

select:hover {
  border-color: var(--primary-color);
  box-shadow: var(--box-shadow);
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-row button {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

#extractBtn {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

#exportBtn {
  background: var(--card-bg-color);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

#extractBtn:hover {
  transform: translateY(-1px);
  box-shadow: var(--box-shadow);
}

#exportBtn:hover {
  background: rgba(33, 150, 243, 0.1);
}

#extractBtn.success {
  background: var(--card-bg-color);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

#exportBtn.success {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
}

.result-container {
  margin-top: 20px;
  position: relative;
}

#result {
  background: var(--result-bg-color);
  padding: 16px;
  border-radius: var(--border-radius);
  font-size: 13px;
  line-height: 1.5;
  max-height: 200px;
  overflow: auto;
  border: var(--group-border);
  box-shadow: var(--box-shadow);
  transition: background-color 0.3s ease;
}

.data-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.group {
  background: var(--group-bg-color);
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: var(--box-shadow);
  border: var(--group-border);
  transition: background-color 0.3s ease, border-color 0.3s;
}

:root[data-theme="dark"] .group {
  border: 2px solid var(--primary-color);
}

.group-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0 0 8px 0;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--primary-color);
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(33,150,243,0.10);
}

.cards-count {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.cards-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.card {
  background: var(--card-bg-color);
  padding: 12px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--box-shadow);
  border-color: var(--primary-color);
}

.card-name {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.card-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
}

.card-change {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 2px 0;
}

.no-cards {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
  font-size: 13px;
  background: var(--card-bg-color);
  border-radius: var(--border-radius);
  border: 1px dashed var(--border-color);
}

.loading {
  text-align: center;
  padding: 20px;
  color: var(--primary-color);
  font-size: 14px;
  background: var(--group-bg-color);
  border-radius: var(--border-radius);
  border: var(--group-border);
}

.error {
  text-align: center;
  padding: 20px;
  color: #f44336;
  font-size: 14px;
  background: rgba(244, 67, 54, 0.1);
  border-radius: var(--border-radius);
  border: 1px solid rgba(244, 67, 54, 0.2);
}

#result::-webkit-scrollbar {
  width: 6px;
}

#result::-webkit-scrollbar-track {
  background: var(--group-bg-color);
  border-radius: 3px;
}

#result::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 3px;
}

.button-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  position: relative;
}

.copy-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 24px;
  min-width: 120px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.clear-btn {
  padding: 8px;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--card-bg-color);
  color: var(--clear-btn-color, #f44336);
  border: 1px solid var(--clear-btn-color, #f44336);
  margin-left: auto;
}

.copy-btn:hover {
  transform: translateX(-50%) translateY(-1px);
  box-shadow: var(--box-shadow);
}

.clear-btn:hover {
  background: var(--clear-btn-hover, rgba(244, 67, 54, 0.1));
}

.copy-btn.copied {
  background: var(--card-bg-color);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.clear-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.template-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.template-label {
  font-size: 13px;
  color: var(--text-color);
  white-space: nowrap;
}

.merchant-row {
  margin-bottom: 16px;
}

.merchant-info {
  font-size: 14px;
  color: var(--text-color);
  padding: 8px 12px;
  background: var(--group-bg-color);
  border-radius: var(--border-radius);
  border: var(--group-border);
}

.period-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.period-label {
  font-size: 13px;
  color: var(--text-color);
  white-space: nowrap;
  margin-right: 8px;
}

#periodSelect {
  min-width: 100px;
}

/* 添加警示样式 */
#templateSelect.warning {
  border-color: #ff4d4f;
  color: #ff4d4f;
  background-color: #fff2f0;
}

#templateSelect.warning:focus {
  border-color: #ff4d4f;
  box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2);
}

/* 暗色主题下的警示样式 */
[data-theme="dark"] #templateSelect.warning {
  border-color: #ff4d4f;
  color: #ff4d4f;
  background-color: rgba(255, 77, 79, 0.1);
}

[data-theme="dark"] #templateSelect.warning:focus {
  border-color: #ff4d4f;
  box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.3);
}

/* 版本号样式 */
.version-info {
  position: fixed;
  left: 8px;
  bottom: 4px;
  font-size: 10px;
  color: #999;
  opacity: 0.6;
  font-family: monospace;
  pointer-events: none;
}

:root[data-theme="dark"] .version-info {
  color: #666;
}

/* 抓取范围样式 */
.scope-container {
  display: flex;
  align-items: center;
  margin: 6px 0 10px 0;
  padding: 0;
  background: none;
  border-radius: 0;
  width: 100%;
  box-sizing: border-box;
}

.scope-label {
  font-size: 12px;
  color: var(--text-primary);
  margin-right: 8px;
  flex-shrink: 0;
  min-width: 56px;
  text-align: left;
}

.scope-flex {
  display: flex;
  align-items: center;
  flex: 1 1 0%;
  gap: 0;
  flex-wrap: nowrap;
  min-width: 0;
}

.scope-options {
  display: flex;
  gap: 16px;
}

.divider {
  margin: 0 12px;
  color: var(--border-color);
  font-size: 16px;
}

.auto-export-container {
  display: flex;
  align-items: center;
  white-space: nowrap;
  margin-left: 12px;
}

.auto-export-container label {
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 12px;
}

.auto-export-container input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.scope-options label {
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 12px;
}

.scope-options input[type="radio"] {
  margin: 0;
  cursor: pointer;
} 